import axios from '@/utils/request';

/**
 * 新增满减信息
 * @params 满减信息
 */
 export async function AddFulldiscount(params) {
    const res = await axios.post('/Fulldiscount/AddFulldiscount',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}



/**
 * 修改满减状态信息
 * @params 满减状态信息
 */
 export async function UpdateFulldiscount(params) {
    const res = await axios.post('/Fulldiscount/UpdateFulldiscount',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 查询满减信息
 * @params 满减信息
 */
 export async function QueryFulldiscountByCondition(params) {
    const res = await axios.post('/Fulldiscount/QueryFulldiscountByCondition',params);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}


/**
 * 根据满减Id查询满减信息
 * @params 满减Id
 */
 export async function QueryFulldiscountById(id) {
    const res = await axios.get('/Fulldiscount/QueryFulldiscountById?id='+id);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 根据满减Id删除满减信息
 * @params 满减Id
 */
 export async function Delete(id) {
    const res = await axios.get('/Fulldiscount/Delete/'+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}
